home *** CD-ROM | disk | FTP | other *** search
- Path: inforamp.net!usenet
- From: pcurran@inforamp.net (Peter Curran)
- Newsgroups: comp.std.c
- Subject: Re: valueless return statement in non-void function
- Date: Wed, 17 Apr 1996 14:11:02 GMT
- Organization: PSC Enterprises
- Message-ID: <4l2u3t$io4@sam.inforamp.net>
- References: <829573502snz@wbriscoe.demon.co.uk> </REdxQ9ytt2Y089yn@csn.net>
- Reply-To: pcurran@inforamp.net
- NNTP-Posting-Host: ts34-09.tor.istar.ca
- X-Newsreader: Forte Free Agent 1.0.82
-
- On 16 Apr 1996 21:41:21 -0600 in article </REdxQ9ytt2Y089yn@csn.net>
- thads@csn.net (Thad Smith) (Thad Smith) wrote:
-
- >In article <829573502snz@wbriscoe.demon.co.uk>,
- >walter briscoe <walter@wbriscoe.demon.co.uk> wrote:
- >>I recently had trouble moving some K&R code to ISO C.
- >>
- >>Specifically, a function without a return statement was used to return a
- >>value with an implicit return at the } terminating the function.
-
- <snip>
-
- >I haven't worked with much K&R code, so don't know how valid that is.
- >I suspect that there is lots of legacy code with an implicit int
- >return type that actually returns values. My early impression of C
- >was that much code was designed to be parsimonious.
-
- >The following proposal would be somewhat better: if the return type is
- >explicitly typed, the return statement must provide a value.
- >Someone will surely trot out some existing working code that violates
- >this, however.
-
- >In the meantime, use a good lint.
-
- Most modern compilers, as far as I have seen, provide a (suppressible) warning
- in this situation. It could be viewed as a quality-of-implementation issue.
-
- --
- Peter Curran pcurran@inforamp.net
-
-